﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Keepo.Models.Services
{
    public class DesignableProductExport
    {
        public DesignableProductExport() { DesignableProductId = -1; }

        public DesignableProductExport(DesignableProduct product)
        {
            DesignableProductId = product.DesignableProductId;
            Title = product.Title;
            ViewProductId = product.ViewProductId;
            NumOfSubProductPages = product.ViewProduct.ProductPages.Select(p=>p.PageIdx).Distinct().Count();
        }

        public DesignableProductExport(DesignableProduct product, int subProductId)
        {
            DesignableProductId = product.DesignableProductId;
            Title = product.Title;
            ViewProductId = product.ViewProductId;
            NumOfSubProductPages = product.ViewProduct.ProductPages.Select(p => p.PageIdx).Distinct().Count();
            SubProductId = subProductId;
        }

        public int DesignableProductId { get; set; }
        public string Title { get; set; }
        public int ViewProductId { get; set; }
        public int NumOfSubProductPages { get; set; }
        public int SubProductId { get; set; }
    }
}